/**
 */
package gatperdut.chato.model.Chato.Util.impl;

import gatperdut.chato.model.Chato.Item.ItemTemplate;
import gatperdut.chato.model.Chato.Util.Lock;
import gatperdut.chato.model.Chato.Util.UtilPackage;
import java.util.Collection;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.internal.cdo.CDOObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Lock</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link gatperdut.chato.model.Chato.Util.impl.LockImpl#isLocked <em>Locked</em>}</li>
 *   <li>{@link gatperdut.chato.model.Chato.Util.impl.LockImpl#getKeys <em>Keys</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class LockImpl extends CDOObjectImpl implements Lock {
	/**
     * The default value of the '{@link #isLocked() <em>Locked</em>}' attribute.
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @see #isLocked()
     * @generated
     * @ordered
     */
    protected static final boolean LOCKED_EDEFAULT = false;

    /**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	protected LockImpl() {
        super();
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	@Override
	protected EClass eStaticClass() {
        return UtilPackage.Literals.LOCK;
    }

	/**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    @Override
    protected int eStaticFeatureCount() {
        return 0;
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public boolean isLocked() {
        return (Boolean)eDynamicGet(UtilPackage.LOCK__LOCKED, UtilPackage.Literals.LOCK__LOCKED, true, true);
    }

    /**
     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setLocked(boolean newLocked) {
        eDynamicSet(UtilPackage.LOCK__LOCKED, UtilPackage.Literals.LOCK__LOCKED, newLocked);
    }

    /**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	@SuppressWarnings("unchecked")
	public EList<ItemTemplate> getKeys() {
        return (EList<ItemTemplate>)eDynamicGet(UtilPackage.LOCK__KEYS, UtilPackage.Literals.LOCK__KEYS, true, true);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
        switch (featureID) {
            case UtilPackage.LOCK__LOCKED:
                return isLocked();
            case UtilPackage.LOCK__KEYS:
                return getKeys();
        }
        return super.eGet(featureID, resolve, coreType);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
        switch (featureID) {
            case UtilPackage.LOCK__LOCKED:
                setLocked((Boolean)newValue);
                return;
            case UtilPackage.LOCK__KEYS:
                getKeys().clear();
                getKeys().addAll((Collection<? extends ItemTemplate>)newValue);
                return;
        }
        super.eSet(featureID, newValue);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	@Override
	public void eUnset(int featureID) {
        switch (featureID) {
            case UtilPackage.LOCK__LOCKED:
                setLocked(LOCKED_EDEFAULT);
                return;
            case UtilPackage.LOCK__KEYS:
                getKeys().clear();
                return;
        }
        super.eUnset(featureID);
    }

	/**
     * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
     * @generated
     */
	@Override
	public boolean eIsSet(int featureID) {
        switch (featureID) {
            case UtilPackage.LOCK__LOCKED:
                return isLocked() != LOCKED_EDEFAULT;
            case UtilPackage.LOCK__KEYS:
                return !getKeys().isEmpty();
        }
        return super.eIsSet(featureID);
    }

} //LockImpl
